package com.nbjtjc.safe.service.sys;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.mapper.sys.SysUserPostMapper;
import com.nbjtjc.safe.model.sys.SysUserPost;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @auther guqianbin
 * @date 2018/8/8 15:35
 **/
@Service
public class SysUserPostService {



    @Autowired
    private SysUserPostMapper sysUserPostMapper;

    public Result add(SysUserPost sysUserPost){
        Result result=new Result();
        sysUserPostMapper.deleteByUserId(sysUserPost.getUserId());
        sysUserPostMapper.insertSelective(sysUserPost);
        return result;
    }

    public Result delete(SysUserPost sysUserPost){
        Result result=new Result();
        sysUserPostMapper.delete(sysUserPost);
        return result;
    }

}
